$(function () {
    $("#btn").click(function () {
        $.ajax({
            url: "/ExamControl/getAllExam",
            type: "post",
            dataType: "json",
            success: function (data) {
                console.log(data);
            }
        })
    });

    $("#btn2").click(function () {
        $.ajax({
            url: "/ExamControl/getExamPaper",
            data: {
                "id": 1
            },
            type: "post",
            dataType: "json",
            success: function (data) {
                console.log(data);
            }
        })
    });

    $("#mark").click(function () {
        var data = {
            "examName": "aaa", //考试名称 *
            "examId": 1,   //试卷id *
            "studentId": 1, //学生id *
            "examResult": [{ // *
                "examId": 1,
                "examAnswer": "B"
            }, {
                "examId": 2,
                "examAnswer": "B"
            }, {
                "examId": 12,
                "examAnswer": "AB"
            }]
        };
        MyAJAX("/ExamControl/getMark", data, false, "post", "application/json;charset=utf-8", "json");
    });
});

function MyAJAX(url, data, async, type, contentType, dataType) {
    $.ajax({
        url: url,
        data: JSON.stringify(data),
        async: async,
        type: type,
        contentType: contentType,
        dataType: dataType,
        success: function (data) {
            console.log(data);
            // return data;
        }
    });
}